home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1999 March / EnigmA AMIGA RUN 35 (1999)(G.R. Edizioni)(IT)[!][issue 1999-03].iso / earcd / emul / cp4 / c2p_src / c2p_monoasm.asm < prev    next >
Assembly Source File  |  1999-01-01  |  7KB  |  340 lines

  1. * :ts=8                c2p_monoasm.asm
  2. *
  3. *    cp4 - Commodore C+4 emulator
  4. *    Copyright (C) 1998 Gáti Gergely
  5. *
  6. *    This program is free software; you can redistribute it and/or modify
  7. *    it under the terms of the GNU General Public License as published by
  8. *    the Free Software Foundation; either version 2 of the License, or
  9. *    (at your option) any later version.
  10. *
  11. *    This program is distributed in the hope that it will be useful,
  12. *    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. *    GNU General Public License for more details.
  15. *
  16. *    You should have received a copy of the GNU General Public License
  17. *    along with this program; if not, write to the Free Software Foundation,
  18. *    Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  19. *
  20. *    e-mail: gatig@dragon.klte.hu
  21. *
  22.  
  23. SCRHEIGHT    EQU    283
  24. SCRWIDTH    EQU    352
  25.  
  26.     xref    _bmx            * l
  27.  
  28.     xdef    _convdeltaasm
  29.     xdef    _convfullasm
  30.  
  31. *
  32. * IN:    a0 - chunky
  33. *    a1 - planar
  34. _convfullasm    movem.l    d2-d7/a2-a3,-(sp)
  35.         move.l    _bmx,d5
  36.         move.l    #$40404040,d7
  37.         move.w    #SCRHEIGHT-2,d0
  38.  
  39. .out        moveq    #(SCRWIDTH/32)-1,d1
  40.         move.l    a1,a2
  41. .in
  42.     ; 1. byte
  43.         move.l    (a0)+,d3    ; D3
  44.         and.l    d7,d3        ;.1......|.2......|.3......|.4......
  45.         lsr.w    #1,d3        ;.1......|.2......|..3.....|..4.....
  46.         move.w    d3,d4        ;                 \------ D4 ------/
  47.         swap    d3        ;             D3:  .1......|.2......
  48.         add.w    d3,d3        ;                  1.......|2.......
  49.         or.w    d3,d4        ;             D4:  1.3.....|2.4.....
  50.         lsr.b    #1,d4        ;             D4:  1.3.....|.2.4....
  51.         move.w    d4,d3        ;                 \------ D3 ------/
  52.         lsr.w    #8,d3        ;             D3:  ........|1.3.....
  53.         or.b    d4,d3        ;             D3:           1234....
  54.         move.b    d3,d6        ;             D6:           1234....
  55.  
  56.         move.l    (a0)+,d3    ; D3
  57.         and.l    d7,d3        ;.1......|.2......|.3......|.4......
  58.         lsr.w    #5,d3        ;.1......|.2......|......3.|......4.
  59.         move.w    d3,d4        ;                 \------ D4 ------/
  60.         swap    d3        ;             D3:  .1......|.2......
  61.         lsr.w    #3,d3        ;             D3:  ....1...|....2...
  62.         or.w    d3,d4        ;                  ....1.3.|....2.4.
  63.         lsr.b    #1,d4        ;             D4:  ....1.3.|.....2.4
  64.         move.w    d4,d3        ;                 \------ D3 ------/
  65.         lsr.w    #8,d3        ;             D3:  ........|....1.3.
  66.         or.b    d4,d3        ;             D3:           ....1234
  67.         or.b    d3,d6        ;             D6:           12341234
  68.         lsl.l    #8,d6
  69.  
  70.     ; 2. byte
  71.         move.l    (a0)+,d3
  72.         and.l    d7,d3
  73.         lsr.w    #1,d3
  74.         move.w    d3,d4
  75.         swap    d3
  76.         add.w    d3,d3
  77.         or.w    d3,d4
  78.         lsr.b    #1,d4
  79.         move.w    d4,d3
  80.         lsr.w    #8,d3
  81.         or.b    d4,d3            ; xxxx....
  82.         move.b    d3,d6            ; xxxx....
  83.  
  84.         move.l    (a0)+,d3
  85.         and.l    d7,d3
  86.         lsr.w    #5,d3
  87.         move.w    d3,d4
  88.         swap    d3
  89.         lsr.w    #3,d3
  90.         or.w    d3,d4
  91.         lsr.b    #1,d4
  92.         move.w    d4,d3
  93.         lsr.w    #8,d3
  94.         or.b    d4,d3            ;....xxxx
  95.         or.b    d3,d6            ;xxxxxxxx
  96.         lsl.l    #8,d6
  97.  
  98.     ; 3. byte
  99.         move.l    (a0)+,d3
  100.         and.l    d7,d3
  101.         lsr.w    #1,d3
  102.         move.w    d3,d4
  103.         swap    d3
  104.         add.w    d3,d3
  105.         or.w    d3,d4
  106.         lsr.b    #1,d4
  107.         move.w    d4,d3
  108.         lsr.w    #8,d3
  109.         or.b    d4,d3            ; xxxx....
  110.         move.b    d3,d6            ; xxxx....
  111.  
  112.         move.l    (a0)+,d3
  113.         and.l    d7,d3
  114.         lsr.w    #5,d3
  115.         move.w    d3,d4
  116.         swap    d3
  117.         lsr.w    #3,d3
  118.         or.w    d3,d4
  119.         lsr.b    #1,d4
  120.         move.w    d4,d3
  121.         lsr.w    #8,d3
  122.         or.b    d4,d3            ;....xxxx
  123.         or.b    d3,d6            ;xxxxxxxx
  124.         lsl.l    #8,d6
  125.  
  126.     ; 4. byte
  127.         move.l    (a0)+,d3
  128.         and.l    d7,d3
  129.         lsr.w    #1,d3
  130.         move.w    d3,d4
  131.         swap    d3
  132.         add.w    d3,d3
  133.         or.w    d3,d4
  134.         lsr.b    #1,d4
  135.         move.w    d4,d3
  136.         lsr.w    #8,d3
  137.         or.b    d4,d3            ; xxxx....
  138.         move.b    d3,d6            ; xxxx....
  139.  
  140.         move.l    (a0)+,d3
  141.         and.l    d7,d3
  142.         lsr.w    #5,d3
  143.         move.w    d3,d4
  144.         swap    d3
  145.         lsr.w    #3,d3
  146.         or.w    d3,d4
  147.         lsr.b    #1,d4
  148.         move.w    d4,d3
  149.         lsr.w    #8,d3
  150.         or.b    d4,d3            ;....xxxx
  151.         or.b    d3,d6            ;xxxxxxxx
  152.  
  153.     ; TO-CHIP
  154.         move.l    d6,(a2)+
  155.         dbf    d1,.in
  156.  
  157.         add.l    d5,a1
  158.         dbf    d0,.out
  159.  
  160.         movem.l    (sp)+,d2-d7/a2-a3
  161.         rts
  162.  
  163.  
  164. *
  165. * IN:    a0 - chunky
  166. *    a1 - planar
  167. *    d0 - delta
  168. *
  169. _convdeltaasm    movem.l    d2-d7/a2-a3,-(sp)
  170.         move.l    _bmx,d5
  171.         move.l    #$40404040,d7
  172.         move.l    d0,a3
  173.         move.w    #SCRHEIGHT-2,d0
  174.  
  175. .out        moveq    #(SCRWIDTH/32)-1,d1
  176.         move.l    a1,a2
  177.  
  178. .in        cmp.l    (a3)+,(a0)+
  179.         bne    .1
  180.         cmp.l    (a3)+,(a0)+
  181.         bne    .2
  182.         cmp.l    (a3)+,(a0)+
  183.         bne    .3
  184.         cmp.l    (a3)+,(a0)+
  185.         bne    .4
  186.         cmp.l    (a3)+,(a0)+
  187.         bne    .5
  188.         cmp.l    (a3)+,(a0)+
  189.         bne    .6
  190.         cmp.l    (a3)+,(a0)+
  191.         bne    .7
  192.         cmp.l    (a3)+,(a0)+
  193.         bne    .8
  194.         addq.l    #4,a2
  195. .tov        dbf    d1,.in
  196.  
  197.         add.l    d5,a1
  198.         dbf    d0,.out
  199.  
  200.         movem.l    (sp)+,d2-d7/a2-a3
  201.         rts
  202.  
  203. .1        subq.l    #4,a0
  204.         add.l    #28,a3
  205.         bra    .conv
  206. .2        subq.l    #8,a0
  207.         add.l    #24,a3
  208.         bra    .conv
  209. .3        sub.l    #12,a0
  210.         add.l    #20,a3
  211.         bra    .conv
  212. .4        sub.l    #16,a0
  213.         add.l    #16,a3
  214.         bra    .conv
  215. .5        sub.l    #20,a0
  216.         add.l    #12,a3
  217.         bra    .conv
  218. .6        sub.l    #24,a0
  219.         addq.l    #8,a3
  220.         bra    .conv
  221. .7        sub.l    #28,a0
  222.         addq.l    #4,a3
  223.         bra    .conv
  224. .8        sub.l    #32,a0
  225.  
  226.     ; 1. byte
  227. .conv        move.l    (a0)+,d3    ; D3
  228.         and.l    d7,d3        ;.1......|.2......|.3......|.4......
  229.         lsr.w    #1,d3        ;.1......|.2......|..3.....|..4.....
  230.         move.w    d3,d4        ;                 \------ D4 ------/
  231.         swap    d3        ;             D3:  .1......|.2......
  232.         add.w    d3,d3        ;                  1.......|2.......
  233.         or.w    d3,d4        ;             D4:  1.3.....|2.4.....
  234.         lsr.b    #1,d4        ;             D4:  1.3.....|.2.4....
  235.         move.w    d4,d3        ;                 \------ D3 ------/
  236.         lsr.w    #8,d3        ;             D3:  ........|1.3.....
  237.         or.b    d4,d3        ;             D3:           1234....
  238.         move.b    d3,d6        ;             D6:           1234....
  239.  
  240.         move.l    (a0)+,d3    ; D3
  241.         and.l    d7,d3        ;.1......|.2......|.3......|.4......
  242.         lsr.w    #5,d3        ;.1......|.2......|......3.|......4.
  243.         move.w    d3,d4        ;                 \------ D4 ------/
  244.         swap    d3        ;             D3:  .1......|.2......
  245.         lsr.w    #3,d3        ;             D3:  ....1...|....2...
  246.         or.w    d3,d4        ;                  ....1.3.|....2.4.
  247.         lsr.b    #1,d4        ;             D4:  ....1.3.|.....2.4
  248.         move.w    d4,d3        ;                 \------ D3 ------/
  249.         lsr.w    #8,d3        ;             D3:  ........|....1.3.
  250.         or.b    d4,d3        ;             D3:           ....1234
  251.         or.b    d3,d6        ;             D6:           12341234
  252.         lsl.l    #8,d6
  253.  
  254.     ; 2. byte
  255.         move.l    (a0)+,d3
  256.         and.l    d7,d3
  257.         lsr.w    #1,d3
  258.         move.w    d3,d4
  259.         swap    d3
  260.         add.w    d3,d3
  261.         or.w    d3,d4
  262.         lsr.b    #1,d4
  263.         move.w    d4,d3
  264.         lsr.w    #8,d3
  265.         or.b    d4,d3            ; xxxx....
  266.         move.b    d3,d6            ; xxxx....
  267.  
  268.         move.l    (a0)+,d3
  269.         and.l    d7,d3
  270.         lsr.w    #5,d3
  271.         move.w    d3,d4
  272.         swap    d3
  273.         lsr.w    #3,d3
  274.         or.w    d3,d4
  275.         lsr.b    #1,d4
  276.         move.w    d4,d3
  277.         lsr.w    #8,d3
  278.         or.b    d4,d3            ;....xxxx
  279.         or.b    d3,d6            ;xxxxxxxx
  280.         lsl.l    #8,d6
  281.  
  282.     ; 3. byte
  283.         move.l    (a0)+,d3
  284.         and.l    d7,d3
  285.         lsr.w    #1,d3
  286.         move.w    d3,d4
  287.         swap    d3
  288.         add.w    d3,d3
  289.         or.w    d3,d4
  290.         lsr.b    #1,d4
  291.         move.w    d4,d3
  292.         lsr.w    #8,d3
  293.         or.b    d4,d3            ; xxxx....
  294.         move.b    d3,d6            ; xxxx....
  295.  
  296.         move.l    (a0)+,d3
  297.         and.l    d7,d3
  298.         lsr.w    #5,d3
  299.         move.w    d3,d4
  300.         swap    d3
  301.         lsr.w    #3,d3
  302.         or.w    d3,d4
  303.         lsr.b    #1,d4
  304.         move.w    d4,d3
  305.         lsr.w    #8,d3
  306.         or.b    d4,d3            ;....xxxx
  307.         or.b    d3,d6            ;xxxxxxxx
  308.         lsl.l    #8,d6
  309.  
  310.     ; 4. byte
  311.         move.l    (a0)+,d3
  312.         and.l    d7,d3
  313.         lsr.w    #1,d3
  314.         move.w    d3,d4
  315.         swap    d3
  316.         add.w    d3,d3
  317.         or.w    d3,d4
  318.         lsr.b    #1,d4
  319.         move.w    d4,d3
  320.         lsr.w    #8,d3
  321.         or.b    d4,d3            ; xxxx....
  322.         move.b    d3,d6            ; xxxx....
  323.  
  324.         move.l    (a0)+,d3
  325.         and.l    d7,d3
  326.         lsr.w    #5,d3
  327.         move.w    d3,d4
  328.         swap    d3
  329.         lsr.w    #3,d3
  330.         or.w    d3,d4
  331.         lsr.b    #1,d4
  332.         move.w    d4,d3
  333.         lsr.w    #8,d3
  334.         or.b    d4,d3            ;....xxxx
  335.         or.b    d3,d6            ;xxxxxxxx
  336.  
  337.     ; TO-CHIP
  338.         move.l    d6,(a2)+
  339.         bra    .tov
  340.